package org.uranus.consul.consumer.config;

import org.springframework.cloud.client.loadbalancer.LoadBalanced;
import org.springframework.cloud.loadbalancer.annotation.LoadBalancerClient;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.client.RestTemplate;
import org.uranus.consul.consumer.rule.CustomLoadBalancerConfiguration;
/**
 * 需要实现ReactorServiceInstanceLoadBalancer接口
 * @author uranus
 *
 */
@Configuration
//@LoadBalancerClients(defaultConfiguration = {name="consul-provider",configuration=CustomLoadBalancerConfiguration.class})
@LoadBalancerClient(name="consul-provider",configuration = CustomLoadBalancerConfiguration.class)
public class ApplicationContextConfig {
	/**
	 * RestTemplate远程调用
	 * @return
	 */
	@Bean
	@LoadBalanced
	public RestTemplate restTemplate() {
		return new RestTemplate();
	}
}
